package test.liyi;

import java.util.Random;

public class OperateStudent {

	public static void main(String[] args) {
		Student[] students = new Student[10] ;
		Random random = new Random();
		for (int i = 0; i < students.length; i++) {
			Student student = new Student();
			student.setChinese(new KeCheng("chinese","001",random.nextInt(100)));
			student.setMath(new KeCheng("math","002",random.nextInt(100)));
			student.setEnglish(new KeCheng("english","003",random.nextInt(100)));
			student.setCode(i + "");
			student.setName("" + i + i + i);
			student.setSex(random.nextBoolean() ? "男": "女");
			students[i] = student;
		}
		double chinese_all = 0;
		double math_all = 0;
		double english_all = 0;
		for (int i = 0; i < students.length; i++) {
			Student student = students[i];
			chinese_all = student.getChinese().getResults() + chinese_all;
			math_all = student.getMath().getResults() + math_all;
			english_all = student.getEnglish().getResults() + english_all;
		}
		//没排序 留给你了
		System.out.printf("chinese %s \n", chinese_all / students.length);
		System.out.printf("math %s \n", math_all / students.length);
		System.out.printf("english %s \n", english_all / students.length);
	}

}
